.class public Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;
.super Ljava/lang/Object;
.source "SPBrandEngageClient.java"


# static fields
.field private static final ABOUT_BLANK:Ljava/lang/String; = "about:blank"

.field public static final INSTANCE:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient; = null

.field private static final MBE_URL_KEY:Ljava/lang/String; = "mbe"

.field public static final SP_ENGAGEMENT_STATUS:Ljava/lang/String; = "ENGAGEMENT_STATUS"

.field private static final SP_NUMBER_OF_OFFERS_PARAMETER_KEY:Ljava/lang/String; = "n"

.field private static final SP_REQUEST_OFFER_ANSWER:Ljava/lang/String; = "requestOffers"

.field private static final SP_REQUEST_START_STATUS:Ljava/lang/String; = "start"

.field public static final SP_REQUEST_STATUS_PARAMETER_ABORTED_VALUE:Ljava/lang/String; = "CLOSE_ABORTED"

.field private static final SP_REQUEST_STATUS_PARAMETER_ENGAGED:Ljava/lang/String; = "USER_ENGAGED"

.field public static final SP_REQUEST_STATUS_PARAMETER_ERROR:Ljava/lang/String; = "ERROR"

.field public static final SP_REQUEST_STATUS_PARAMETER_FINISHED_VALUE:Ljava/lang/String; = "CLOSE_FINISHED"

.field private static final SP_REQUEST_STATUS_PARAMETER_KEY:Ljava/lang/String; = "status"

.field private static final SP_REQUEST_STATUS_PARAMETER_STARTED_VALUE:Ljava/lang/String; = "STARTED"

.field private static final SP_START_ENGAGEMENT:Ljava/lang/String; = "javascript:Sponsorpay.MBE.SDKInterface.do_start()"

.field private static final TAG:Ljava/lang/String; = "SPBrandEngageClient"

.field private static final TIMEOUT:I = 0x2710

.field private static final VCS_TIMEOUT:I = 0xbb8


# instance fields
.field private mActivity:Landroid/app/Activity;

.field private mChromeClient:Landroid/webkit/WebChromeClient;

.field private mContext:Landroid/content/Context;

.field private mCurrency:Ljava/lang/String;

.field private mCustomParameters:Ljava/util/Map;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation
.end field

.field private mHandler:Landroid/os/Handler;

.field private mNetworkStateReceiver:Landroid/content/BroadcastReceiver;

.field private mOnTouchListener:Landroid/view/View$OnTouchListener;

.field private mShowRewardsNotification:Z

.field private mShowingDialog:Z

.field private mStatus:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

.field private mStatusListener:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener;

.field private mVCSListener:Lcom/sponsorpay/sdk/android/publisher/currency/SPCurrencyServerListener;

.field private mWebClient:Landroid/webkit/WebViewClient;

.field private mWebView:Landroid/webkit/WebView;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 80
    new-instance v0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;

    invoke-direct {v0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;-><init>()V

    sput-object v0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->INSTANCE:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;

    .line 117
    return-void
.end method

.method private constructor <init>()V
    .locals 1

    .prologue
    .line 159
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 124
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mShowingDialog:Z

    .line 129
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mShowRewardsNotification:Z

    .line 131
    sget-object v0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;->MUST_QUERY_SERVER_FOR_OFFERS:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    iput-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mStatus:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    .line 140
    new-instance v0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$1;

    invoke-direct {v0, p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$1;-><init>(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;)V

    iput-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mNetworkStateReceiver:Landroid/content/BroadcastReceiver;

    .line 160
    new-instance v0, Landroid/os/Handler;

    invoke-direct {v0}, Landroid/os/Handler;-><init>()V

    iput-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mHandler:Landroid/os/Handler;

    .line 161
    return-void
.end method

.method static synthetic access$0(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;)Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;
    .locals 1
    .parameter

    .prologue
    .line 131
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mStatus:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    return-object v0
.end method

.method static synthetic access$1(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;)Landroid/os/Handler;
    .locals 1
    .parameter

    .prologue
    .line 122
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mHandler:Landroid/os/Handler;

    return-object v0
.end method

.method static synthetic access$10(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;I)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 299
    invoke-direct {p0, p1}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->processQueryOffersResponse(I)V

    return-void
.end method

.method static synthetic access$11(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;Ljava/lang/String;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 311
    invoke-direct {p0, p1}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->changeStatus(Ljava/lang/String;)V

    return-void
.end method

.method static synthetic access$12(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;)Landroid/app/Activity;
    .locals 1
    .parameter

    .prologue
    .line 119
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mActivity:Landroid/app/Activity;

    return-object v0
.end method

.method static synthetic access$13(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;)Z
    .locals 1
    .parameter

    .prologue
    .line 124
    iget-boolean v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mShowingDialog:Z

    return v0
.end method

.method static synthetic access$2(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;Ljava/lang/String;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 479
    invoke-direct {p0, p1}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->showErrorDialog(Ljava/lang/String;)V

    return-void
.end method

.method static synthetic access$3(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;)V
    .locals 0
    .parameter

    .prologue
    .line 330
    invoke-direct {p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->clearWebViewPage()V

    return-void
.end method

.method static synthetic access$4(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;)Landroid/webkit/WebView;
    .locals 1
    .parameter

    .prologue
    .line 121
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebView:Landroid/webkit/WebView;

    return-object v0
.end method

.method static synthetic access$5(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener$SPBrandEngageClientStatus;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 442
    invoke-direct {p0, p1}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->notifyListener(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener$SPBrandEngageClientStatus;)V

    return-void
.end method

.method static synthetic access$6(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;Z)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 124
    iput-boolean p1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mShowingDialog:Z

    return-void
.end method

.method static synthetic access$7(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;)Landroid/content/Context;
    .locals 1
    .parameter

    .prologue
    .line 120
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mContext:Landroid/content/Context;

    return-object v0
.end method

.method static synthetic access$8(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;)Lcom/sponsorpay/sdk/android/publisher/currency/SPCurrencyServerListener;
    .locals 1
    .parameter

    .prologue
    .line 133
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mVCSListener:Lcom/sponsorpay/sdk/android/publisher/currency/SPCurrencyServerListener;

    return-object v0
.end method

.method static synthetic access$9(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;)Ljava/lang/String;
    .locals 1
    .parameter

    .prologue
    .line 126
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mCurrency:Ljava/lang/String;

    return-object v0
.end method

.method private canChangeParameters()Z
    .locals 1

    .prologue
    .line 275
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mStatus:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    invoke-virtual {v0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;->canChangeParameters()Z

    move-result v0

    return v0
.end method

.method private changeStatus(Ljava/lang/String;)V
    .locals 1
    .parameter "status"

    .prologue
    .line 312
    const-string v0, "STARTED"

    invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_1

    .line 313
    sget-object v0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;->SHOWING_OFFERS:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    invoke-direct {p0, v0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->setClientStatus(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;)V

    .line 314
    sget-object v0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener$SPBrandEngageClientStatus;->STARTED:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener$SPBrandEngageClientStatus;

    invoke-direct {p0, v0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->notifyListener(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener$SPBrandEngageClientStatus;)V

    .line 328
    :cond_0
    :goto_0
    return-void

    .line 315
    :cond_1
    const-string v0, "CLOSE_FINISHED"

    invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_2

    .line 316
    invoke-direct {p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->clearWebViewPage()V

    .line 317
    sget-object v0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener$SPBrandEngageClientStatus;->CLOSE_FINISHED:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener$SPBrandEngageClientStatus;

    invoke-direct {p0, v0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->notifyListener(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener$SPBrandEngageClientStatus;)V

    .line 318
    invoke-direct {p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->showRewardsNotification()V

    .line 319
    invoke-direct {p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->checkForCoins()V

    goto :goto_0

    .line 320
    :cond_2
    const-string v0, "CLOSE_ABORTED"

    invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_3

    .line 321
    invoke-direct {p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->clearWebViewPage()V

    .line 322
    sget-object v0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener$SPBrandEngageClientStatus;->CLOSE_ABORTED:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener$SPBrandEngageClientStatus;

    invoke-direct {p0, v0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->notifyListener(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener$SPBrandEngageClientStatus;)V

    goto :goto_0

    .line 323
    :cond_3
    const-string v0, "ERROR"

    invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_4

    .line 324
    sget-object v0, Lcom/sponsorpay/sdk/android/publisher/SponsorPayPublisher$UIStringIdentifier;->MBE_ERROR_DIALOG_MESSAGE_DEFAULT:Lcom/sponsorpay/sdk/android/publisher/SponsorPayPublisher$UIStringIdentifier;

    invoke-static {v0}, Lcom/sponsorpay/sdk/android/publisher/SponsorPayPublisher;->getUIString(Lcom/sponsorpay/sdk/android/publisher/SponsorPayPublisher$UIStringIdentifier;)Ljava/lang/String;

    move-result-object v0

    invoke-direct {p0, v0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->showErrorDialog(Ljava/lang/String;)V

    goto :goto_0

    .line 325
    :cond_4
    const-string v0, "USER_ENGAGED"

    invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 326
    sget-object v0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;->USER_ENGAGED:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    invoke-direct {p0, v0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->setClientStatus(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;)V

    goto :goto_0
.end method

.method private checkEngagementStarted()V
    .locals 4

    .prologue
    .line 345
    new-instance v0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$3;

    invoke-direct {v0, p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$3;-><init>(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;)V

    .line 358
    .local v0, r:Ljava/lang/Runnable;
    iget-object v1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mHandler:Landroid/os/Handler;

    const-wide/16 v2, 0x2710

    invoke-virtual {v1, v0, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    .line 359
    return-void
.end method

.method private checkForCoins()V
    .locals 4

    .prologue
    .line 521
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mVCSListener:Lcom/sponsorpay/sdk/android/publisher/currency/SPCurrencyServerListener;

    if-eqz v0, :cond_0

    .line 523
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mHandler:Landroid/os/Handler;

    new-instance v1, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$5;

    invoke-direct {v1, p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$5;-><init>(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;)V

    .line 534
    const-wide/16 v2, 0xbb8

    .line 523
    invoke-virtual {v0, v1, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    .line 536
    :cond_0
    return-void
.end method

.method private clearWebViewPage()V
    .locals 3

    .prologue
    const/4 v2, 0x0

    .line 331
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebView:Landroid/webkit/WebView;

    if-eqz v0, :cond_0

    .line 332
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebView:Landroid/webkit/WebView;

    const-string v1, "about:blank"

    invoke-virtual {v0, v1}, Landroid/webkit/WebView;->loadUrl(Ljava/lang/String;)V

    .line 334
    :cond_0
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mStatus:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    sget-object v1, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;->SHOWING_OFFERS:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    if-eq v0, v1, :cond_1

    .line 335
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mStatus:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    sget-object v1, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;->USER_ENGAGED:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    if-eq v0, v1, :cond_1

    .line 336
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mStatus:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    sget-object v1, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;->READY_TO_SHOW_OFFERS:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    if-ne v0, v1, :cond_2

    .line 337
    :cond_1
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mContext:Landroid/content/Context;

    iget-object v1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mNetworkStateReceiver:Landroid/content/BroadcastReceiver;

    invoke-virtual {v0, v1}, Landroid/content/Context;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V

    .line 339
    :cond_2
    iput-object v2, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebView:Landroid/webkit/WebView;

    .line 340
    iput-object v2, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mActivity:Landroid/app/Activity;

    .line 341
    sget-object v0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;->MUST_QUERY_SERVER_FOR_OFFERS:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    invoke-direct {p0, v0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->setClientStatus(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;)V

    .line 342
    return-void
.end method

.method private getBaseUrl()Ljava/lang/String;
    .locals 1

    .prologue
    .line 503
    const-string v0, "mbe"

    invoke-static {v0}, Lcom/sponsorpay/sdk/android/utils/SponsorPayBaseUrlProvider;->getBaseUrl(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method private getOnTouchListener()Landroid/view/View$OnTouchListener;
    .locals 3

    .prologue
    .line 649
    iget-object v2, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mOnTouchListener:Landroid/view/View$OnTouchListener;

    if-nez v2, :cond_0

    .line 650
    new-instance v0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$8;

    invoke-direct {v0, p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$8;-><init>(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;)V

    .line 672
    .local v0, doubleTapListener:Landroid/view/GestureDetector$OnDoubleTapListener;
    new-instance v1, Landroid/view/GestureDetector;

    new-instance v2, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$9;

    invoke-direct {v2, p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$9;-><init>(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;)V

    invoke-direct {v1, v2}, Landroid/view/GestureDetector;-><init>(Landroid/view/GestureDetector$OnGestureListener;)V

    .line 704
    .local v1, gestureDetector:Landroid/view/GestureDetector;
    invoke-virtual {v1, v0}, Landroid/view/GestureDetector;->setOnDoubleTapListener(Landroid/view/GestureDetector$OnDoubleTapListener;)V

    .line 706
    new-instance v2, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$10;

    invoke-direct {v2, p0, v1}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$10;-><init>(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;Landroid/view/GestureDetector;)V

    iput-object v2, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mOnTouchListener:Landroid/view/View$OnTouchListener;

    .line 714
    .end local v0           #doubleTapListener:Landroid/view/GestureDetector$OnDoubleTapListener;
    .end local v1           #gestureDetector:Landroid/view/GestureDetector;
    :cond_0
    iget-object v2, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mOnTouchListener:Landroid/view/View$OnTouchListener;

    return-object v2
.end method

.method private getWebChromeClient()Landroid/webkit/WebChromeClient;
    .locals 1

    .prologue
    .line 607
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mChromeClient:Landroid/webkit/WebChromeClient;

    if-nez v0, :cond_0

    .line 608
    new-instance v0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$7;

    invoke-direct {v0, p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$7;-><init>(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;)V

    iput-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mChromeClient:Landroid/webkit/WebChromeClient;

    .line 645
    :cond_0
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mChromeClient:Landroid/webkit/WebChromeClient;

    return-object v0
.end method

.method private getWebClient()Landroid/webkit/WebViewClient;
    .locals 2

    .prologue
    .line 540
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebClient:Landroid/webkit/WebViewClient;

    if-nez v0, :cond_0

    .line 542
    new-instance v0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$6;

    iget-object v1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mActivity:Landroid/app/Activity;

    invoke-direct {v0, p0, v1}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$6;-><init>(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;Landroid/app/Activity;)V

    iput-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebClient:Landroid/webkit/WebViewClient;

    .line 603
    :cond_0
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebClient:Landroid/webkit/WebViewClient;

    return-object v0
.end method

.method private notifyListener(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener$SPBrandEngageClientStatus;)V
    .locals 3
    .parameter "status"

    .prologue
    .line 443
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mStatusListener:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener;

    if-eqz v0, :cond_0

    .line 444
    const-string v0, "SPBrandEngageClient"

    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "SPBrandEngageClientStatus -> "

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/sponsorpay/sdk/android/utils/SponsorPayLogger;->i(Ljava/lang/String;Ljava/lang/String;)V

    .line 445
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mStatusListener:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener;

    invoke-interface {v0, p1}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener;->didChangeStatus(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener$SPBrandEngageClientStatus;)V

    .line 447
    :cond_0
    return-void
.end method

.method private processQueryOffersResponse(I)V
    .locals 2
    .parameter "numOffers"

    .prologue
    .line 300
    if-lez p1, :cond_1

    const/4 v0, 0x1

    .line 301
    .local v0, areOffersAvailable:Z
    :goto_0
    if-eqz v0, :cond_2

    .line 302
    sget-object v1, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;->READY_TO_SHOW_OFFERS:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    invoke-direct {p0, v1}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->setClientStatus(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;)V

    .line 306
    :goto_1
    iget-object v1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mStatusListener:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener;

    if-eqz v1, :cond_0

    .line 307
    iget-object v1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mStatusListener:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener;

    invoke-interface {v1, v0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener;->didReceiveOffers(Z)V

    .line 309
    :cond_0
    return-void

    .line 300
    .end local v0           #areOffersAvailable:Z
    :cond_1
    const/4 v0, 0x0

    goto :goto_0

    .line 304
    .restart local v0       #areOffersAvailable:Z
    :cond_2
    sget-object v1, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;->MUST_QUERY_SERVER_FOR_OFFERS:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    invoke-direct {p0, v1}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->setClientStatus(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;)V

    goto :goto_1
.end method

.method private setClientStatus(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;)V
    .locals 3
    .parameter "newStatus"

    .prologue
    .line 507
    iput-object p1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mStatus:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    .line 508
    const-string v0, "SPBrandEngageClient"

    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "SPBrandEngageClient mStatus -> "

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {p1}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;->name()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/sponsorpay/sdk/android/utils/SponsorPayLogger;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 509
    return-void
.end method

.method private setupWebView(Landroid/app/Activity;)V
    .locals 5
    .parameter "activity"

    .prologue
    const/4 v4, 0x1

    const/4 v3, 0x0

    .line 451
    sget v1, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v2, 0xb

    if-ge v1, v2, :cond_1

    .end local p1
    :goto_0
    iput-object p1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mContext:Landroid/content/Context;

    .line 453
    new-instance v1, Landroid/webkit/WebView;

    iget-object v2, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mContext:Landroid/content/Context;

    invoke-direct {v1, v2}, Landroid/webkit/WebView;-><init>(Landroid/content/Context;)V

    iput-object v1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebView:Landroid/webkit/WebView;

    .line 455
    iget-object v1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebView:Landroid/webkit/WebView;

    invoke-virtual {v1}, Landroid/webkit/WebView;->getSettings()Landroid/webkit/WebSettings;

    move-result-object v1

    invoke-virtual {v1, v4}, Landroid/webkit/WebSettings;->setJavaScriptEnabled(Z)V

    .line 456
    iget-object v1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebView:Landroid/webkit/WebView;

    invoke-virtual {v1}, Landroid/webkit/WebView;->getSettings()Landroid/webkit/WebSettings;

    move-result-object v1

    invoke-virtual {v1, v4}, Landroid/webkit/WebSettings;->setPluginsEnabled(Z)V

    .line 458
    iget-object v1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebView:Landroid/webkit/WebView;

    invoke-virtual {v1}, Landroid/webkit/WebView;->getSettings()Landroid/webkit/WebSettings;

    move-result-object v1

    invoke-virtual {v1, v3}, Landroid/webkit/WebSettings;->setUseWideViewPort(Z)V

    .line 460
    iget-object v1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebView:Landroid/webkit/WebView;

    invoke-virtual {v1, v3}, Landroid/webkit/WebView;->setBackgroundColor(I)V

    .line 462
    sget v1, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v2, 0xe

    if-ge v1, v2, :cond_0

    .line 463
    iget-object v1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebView:Landroid/webkit/WebView;

    invoke-virtual {v1}, Landroid/webkit/WebView;->getSettings()Landroid/webkit/WebSettings;

    move-result-object v1

    invoke-virtual {v1, v4}, Landroid/webkit/WebSettings;->setUserAgent(I)V

    .line 466
    :cond_0
    iget-object v1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebView:Landroid/webkit/WebView;

    invoke-virtual {v1, v3}, Landroid/webkit/WebView;->setScrollBarStyle(I)V

    .line 468
    iget-object v1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebView:Landroid/webkit/WebView;

    invoke-direct {p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->getWebChromeClient()Landroid/webkit/WebChromeClient;

    move-result-object v2

    invoke-virtual {v1, v2}, Landroid/webkit/WebView;->setWebChromeClient(Landroid/webkit/WebChromeClient;)V

    .line 470
    iget-object v1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebView:Landroid/webkit/WebView;

    invoke-direct {p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->getWebClient()Landroid/webkit/WebViewClient;

    move-result-object v2

    invoke-virtual {v1, v2}, Landroid/webkit/WebView;->setWebViewClient(Landroid/webkit/WebViewClient;)V

    .line 472
    iget-object v1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebView:Landroid/webkit/WebView;

    invoke-direct {p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->getOnTouchListener()Landroid/view/View$OnTouchListener;

    move-result-object v2

    invoke-virtual {v1, v2}, Landroid/webkit/WebView;->setOnTouchListener(Landroid/view/View$OnTouchListener;)V

    .line 474
    new-instance v0, Landroid/content/IntentFilter;

    .line 475
    const-string v1, "android.net.conn.CONNECTIVITY_CHANGE"

    .line 474
    invoke-direct {v0, v1}, Landroid/content/IntentFilter;-><init>(Ljava/lang/String;)V

    .line 476
    .local v0, filter:Landroid/content/IntentFilter;
    iget-object v1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mContext:Landroid/content/Context;

    iget-object v2, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mNetworkStateReceiver:Landroid/content/BroadcastReceiver;

    invoke-virtual {v1, v2, v0}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

    .line 477
    return-void

    .line 451
    .end local v0           #filter:Landroid/content/IntentFilter;
    .restart local p1
    :cond_1
    invoke-virtual {p1}, Landroid/app/Activity;->getApplicationContext()Landroid/content/Context;

    move-result-object p1

    goto :goto_0
.end method

.method private showErrorDialog(Ljava/lang/String;)V
    .locals 5
    .parameter "message"

    .prologue
    .line 480
    iget-boolean v2, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mShowingDialog:Z

    if-nez v2, :cond_0

    iget-object v2, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebView:Landroid/webkit/WebView;

    if-eqz v2, :cond_0

    .line 481
    const/4 v2, 0x1

    iput-boolean v2, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mShowingDialog:Z

    .line 482
    new-instance v0, Landroid/app/AlertDialog$Builder;

    iget-object v2, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mActivity:Landroid/app/Activity;

    if-nez v2, :cond_1

    iget-object v2, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mContext:Landroid/content/Context;

    :goto_0
    invoke-direct {v0, v2}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V

    .line 483
    .local v0, dialogBuilder:Landroid/app/AlertDialog$Builder;
    sget-object v2, Lcom/sponsorpay/sdk/android/publisher/SponsorPayPublisher$UIStringIdentifier;->MBE_ERROR_DIALOG_TITLE:Lcom/sponsorpay/sdk/android/publisher/SponsorPayPublisher$UIStringIdentifier;

    invoke-static {v2}, Lcom/sponsorpay/sdk/android/publisher/SponsorPayPublisher;->getUIString(Lcom/sponsorpay/sdk/android/publisher/SponsorPayPublisher$UIStringIdentifier;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Landroid/app/AlertDialog$Builder;->setTitle(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;

    move-result-object v2

    invoke-virtual {v2, p1}, Landroid/app/AlertDialog$Builder;->setMessage(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;

    move-result-object v2

    .line 484
    sget-object v3, Lcom/sponsorpay/sdk/android/publisher/SponsorPayPublisher$UIStringIdentifier;->MBE_ERROR_DIALOG_BUTTON_TITLE_DISMISS:Lcom/sponsorpay/sdk/android/publisher/SponsorPayPublisher$UIStringIdentifier;

    invoke-static {v3}, Lcom/sponsorpay/sdk/android/publisher/SponsorPayPublisher;->getUIString(Lcom/sponsorpay/sdk/android/publisher/SponsorPayPublisher$UIStringIdentifier;)Ljava/lang/String;

    move-result-object v3

    .line 485
    new-instance v4, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$4;

    invoke-direct {v4, p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$4;-><init>(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;)V

    .line 484
    invoke-virtual {v2, v3, v4}, Landroid/app/AlertDialog$Builder;->setNeutralButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;

    .line 494
    :try_start_0
    invoke-virtual {v0}, Landroid/app/AlertDialog$Builder;->show()Landroid/app/AlertDialog;
    :try_end_0
    .catch Landroid/view/WindowManager$BadTokenException; {:try_start_0 .. :try_end_0} :catch_0

    .line 500
    .end local v0           #dialogBuilder:Landroid/app/AlertDialog$Builder;
    :cond_0
    :goto_1
    return-void

    .line 482
    :cond_1
    iget-object v2, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mActivity:Landroid/app/Activity;

    goto :goto_0

    .line 495
    .restart local v0       #dialogBuilder:Landroid/app/AlertDialog$Builder;
    :catch_0
    move-exception v1

    .line 496
    .local v1, e:Landroid/view/WindowManager$BadTokenException;
    const/4 v2, 0x0

    iput-boolean v2, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mShowingDialog:Z

    .line 497
    const-string v2, "SPBrandEngageClient"

    const-string v3, "Unable to show the dialog window"

    invoke-static {v2, v3}, Lcom/sponsorpay/sdk/android/utils/SponsorPayLogger;->e(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_1
.end method

.method private showRewardsNotification()V
    .locals 3

    .prologue
    .line 512
    iget-boolean v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mShowRewardsNotification:Z

    if-eqz v0, :cond_0

    .line 513
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mContext:Landroid/content/Context;

    .line 515
    sget-object v1, Lcom/sponsorpay/sdk/android/publisher/SponsorPayPublisher$UIStringIdentifier;->MBE_REWARD_NOTIFICATION:Lcom/sponsorpay/sdk/android/publisher/SponsorPayPublisher$UIStringIdentifier;

    invoke-static {v1}, Lcom/sponsorpay/sdk/android/publisher/SponsorPayPublisher;->getUIString(Lcom/sponsorpay/sdk/android/publisher/SponsorPayPublisher$UIStringIdentifier;)Ljava/lang/String;

    move-result-object v1

    .line 516
    const/4 v2, 0x1

    .line 513
    invoke-static {v0, v1, v2}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;

    move-result-object v0

    .line 516
    invoke-virtual {v0}, Landroid/widget/Toast;->show()V

    .line 518
    :cond_0
    return-void
.end method

.method private startQueryingOffers(Lcom/sponsorpay/sdk/android/credentials/SPCredentials;)V
    .locals 5
    .parameter "credentials"

    .prologue
    .line 201
    invoke-direct {p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->getBaseUrl()Ljava/lang/String;

    move-result-object v2

    invoke-static {v2, p1}, Lcom/sponsorpay/sdk/android/utils/UrlBuilder;->newBuilder(Ljava/lang/String;Lcom/sponsorpay/sdk/android/credentials/SPCredentials;)Lcom/sponsorpay/sdk/android/utils/UrlBuilder;

    move-result-object v2

    .line 202
    iget-object v3, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mCurrency:Ljava/lang/String;

    invoke-virtual {v2, v3}, Lcom/sponsorpay/sdk/android/utils/UrlBuilder;->setCurrency(Ljava/lang/String;)Lcom/sponsorpay/sdk/android/utils/UrlBuilder;

    move-result-object v2

    iget-object v3, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mCustomParameters:Ljava/util/Map;

    invoke-virtual {v2, v3}, Lcom/sponsorpay/sdk/android/utils/UrlBuilder;->addExtraKeysValues(Ljava/util/Map;)Lcom/sponsorpay/sdk/android/utils/UrlBuilder;

    move-result-object v2

    .line 203
    invoke-virtual {v2}, Lcom/sponsorpay/sdk/android/utils/UrlBuilder;->addScreenMetrics()Lcom/sponsorpay/sdk/android/utils/UrlBuilder;

    move-result-object v2

    invoke-virtual {v2}, Lcom/sponsorpay/sdk/android/utils/UrlBuilder;->buildUrl()Ljava/lang/String;

    move-result-object v0

    .line 204
    .local v0, requestUrl:Ljava/lang/String;
    const-string v2, "SPBrandEngageClient"

    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "Loading URL: "

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-static {v2, v3}, Lcom/sponsorpay/sdk/android/utils/SponsorPayLogger;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 205
    iget-object v2, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebView:Landroid/webkit/WebView;

    invoke-virtual {v2, v0}, Landroid/webkit/WebView;->loadUrl(Ljava/lang/String;)V

    .line 206
    sget-object v2, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;->QUERYING_SERVER_FOR_OFFERS:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    invoke-direct {p0, v2}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->setClientStatus(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;)V

    .line 207
    new-instance v1, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$2;

    invoke-direct {v1, p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$2;-><init>(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;)V

    .line 216
    .local v1, timeout:Ljava/lang/Runnable;
    iget-object v2, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mHandler:Landroid/os/Handler;

    const-wide/16 v3, 0x2710

    invoke-virtual {v2, v1, v3, v4}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    .line 217
    return-void
.end method


# virtual methods
.method public canRequestOffers()Z
    .locals 1

    .prologue
    .line 263
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mStatus:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    invoke-virtual {v0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;->canRequestOffers()Z

    move-result v0

    return v0
.end method

.method public canStartEngagement()Z
    .locals 1

    .prologue
    .line 271
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mStatus:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    invoke-virtual {v0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;->canShowOffers()Z

    move-result v0

    return v0
.end method

.method public closeEngagement()V
    .locals 2

    .prologue
    .line 251
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mStatus:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    sget-object v1, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;->USER_ENGAGED:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    if-ne v0, v1, :cond_0

    .line 252
    const-string v0, "CLOSE_FINISHED"

    invoke-direct {p0, v0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->changeStatus(Ljava/lang/String;)V

    .line 256
    :goto_0
    return-void

    .line 254
    :cond_0
    const-string v0, "CLOSE_ABORTED"

    invoke-direct {p0, v0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->changeStatus(Ljava/lang/String;)V

    goto :goto_0
.end method

.method public onPause()V
    .locals 2

    .prologue
    .line 720
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mHandler:Landroid/os/Handler;

    new-instance v1, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$11;

    invoke-direct {v1, p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient$11;-><init>(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;)V

    invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 734
    return-void
.end method

.method public requestOffers(Lcom/sponsorpay/sdk/android/credentials/SPCredentials;Landroid/app/Activity;)Z
    .locals 3
    .parameter "credentials"
    .parameter "activity"

    .prologue
    const/4 v0, 0x0

    .line 181
    invoke-virtual {p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->canRequestOffers()Z

    move-result v1

    if-eqz v1, :cond_2

    .line 182
    sget v1, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v2, 0x8

    if-ge v1, v2, :cond_0

    .line 184
    invoke-direct {p0, v0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->processQueryOffersResponse(I)V

    .line 191
    :goto_0
    const/4 v0, 0x1

    .line 196
    :goto_1
    return v0

    .line 186
    :cond_0
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebView:Landroid/webkit/WebView;

    if-nez v0, :cond_1

    .line 187
    invoke-direct {p0, p2}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->setupWebView(Landroid/app/Activity;)V

    .line 189
    :cond_1
    invoke-direct {p0, p1}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->startQueryingOffers(Lcom/sponsorpay/sdk/android/credentials/SPCredentials;)V

    goto :goto_0

    .line 193
    :cond_2
    const-string v1, "SPBrandEngageClient"

    const-string v2, "SPBrandEngageClient cannot request offers at this point. It might be requesting offers right now or an offer might be currently being presented to the user."

    invoke-static {v1, v2}, Lcom/sponsorpay/sdk/android/utils/SponsorPayLogger;->d(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_1
.end method

.method public setCurrencyListener(Lcom/sponsorpay/sdk/android/publisher/currency/SPCurrencyServerListener;)Z
    .locals 2
    .parameter "listener"

    .prologue
    .line 412
    invoke-direct {p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->canChangeParameters()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 413
    iput-object p1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mVCSListener:Lcom/sponsorpay/sdk/android/publisher/currency/SPCurrencyServerListener;

    .line 414
    sget-object v0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;->MUST_QUERY_SERVER_FOR_OFFERS:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    invoke-direct {p0, v0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->setClientStatus(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;)V

    .line 415
    const/4 v0, 0x1

    .line 419
    :goto_0
    return v0

    .line 417
    :cond_0
    const-string v0, "SPBrandEngageClient"

    const-string v1, "Cannot change the currency listener while a request to the server is going on or an offer is being presented to the user."

    invoke-static {v0, v1}, Lcom/sponsorpay/sdk/android/utils/SponsorPayLogger;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 419
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public setCurrencyName(Ljava/lang/String;)Z
    .locals 2
    .parameter "currencyName"

    .prologue
    .line 370
    invoke-direct {p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->canChangeParameters()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 371
    iput-object p1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mCurrency:Ljava/lang/String;

    .line 372
    sget-object v0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;->MUST_QUERY_SERVER_FOR_OFFERS:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    invoke-direct {p0, v0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->setClientStatus(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;)V

    .line 373
    const/4 v0, 0x1

    .line 377
    :goto_0
    return v0

    .line 375
    :cond_0
    const-string v0, "SPBrandEngageClient"

    const-string v1, "Cannot change the currency while a request to the server is going on or an offer is being presented to the user."

    invoke-static {v0, v1}, Lcom/sponsorpay/sdk/android/utils/SponsorPayLogger;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 377
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public setCustomParameters(Ljava/util/Map;)Z
    .locals 2
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/String;",
            ">;)Z"
        }
    .end annotation

    .prologue
    .line 390
    .local p1, parameters:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;"
    invoke-direct {p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->canChangeParameters()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 391
    iput-object p1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mCustomParameters:Ljava/util/Map;

    .line 392
    sget-object v0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;->MUST_QUERY_SERVER_FOR_OFFERS:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;

    invoke-direct {p0, v0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->setClientStatus(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageOffersStatus;)V

    .line 393
    const/4 v0, 0x1

    .line 397
    :goto_0
    return v0

    .line 395
    :cond_0
    const-string v0, "SPBrandEngageClient"

    const-string v1, "Cannot change custom parameters while a request to the server is going on or an offer is being presented to the user."

    invoke-static {v0, v1}, Lcom/sponsorpay/sdk/android/utils/SponsorPayLogger;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 397
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public setShowRewardsNotification(Z)V
    .locals 0
    .parameter "mShowRewardsNotification"

    .prologue
    .line 296
    iput-boolean p1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mShowRewardsNotification:Z

    .line 297
    return-void
.end method

.method public setStatusListener(Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener;)Z
    .locals 3
    .parameter "listener"

    .prologue
    .line 432
    invoke-direct {p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->canChangeParameters()Z

    move-result v0

    .line 433
    .local v0, canChangeParameters:Z
    if-eqz v0, :cond_0

    .line 434
    iput-object p1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mStatusListener:Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClientStatusListener;

    .line 439
    :goto_0
    return v0

    .line 436
    :cond_0
    const-string v1, "SPBrandEngageClient"

    const-string v2, "Cannot change the status listener while a request to the server is going on or an offer is being presented to the user."

    invoke-static {v1, v2}, Lcom/sponsorpay/sdk/android/utils/SponsorPayLogger;->d(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0
.end method

.method public shouldShowRewardsNotification()Z
    .locals 1

    .prologue
    .line 287
    iget-boolean v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mShowRewardsNotification:Z

    return v0
.end method

.method public startEngagement(Landroid/app/Activity;)Z
    .locals 4
    .parameter "activity"

    .prologue
    const/4 v3, -0x1

    .line 228
    invoke-virtual {p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->canStartEngagement()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 230
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebView:Landroid/webkit/WebView;

    const-string v1, "javascript:Sponsorpay.MBE.SDKInterface.do_start()"

    invoke-virtual {v0, v1}, Landroid/webkit/WebView;->loadUrl(Ljava/lang/String;)V

    .line 232
    iput-object p1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mActivity:Landroid/app/Activity;

    .line 233
    iget-object v0, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mActivity:Landroid/app/Activity;

    iget-object v1, p0, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->mWebView:Landroid/webkit/WebView;

    new-instance v2, Landroid/widget/FrameLayout$LayoutParams;

    .line 235
    invoke-direct {v2, v3, v3}, Landroid/widget/FrameLayout$LayoutParams;-><init>(II)V

    .line 233
    invoke-virtual {v0, v1, v2}, Landroid/app/Activity;->addContentView(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V

    .line 237
    invoke-direct {p0}, Lcom/sponsorpay/sdk/android/publisher/mbe/SPBrandEngageClient;->checkEngagementStarted()V

    .line 238
    const/4 v0, 0x1

    .line 243
    :goto_0
    return v0

    .line 240
    :cond_0
    const-string v0, "SPBrandEngageClient"

    const-string v1, "SPBrandEngageClient is not ready to show offers. Call requestOffers() and wait until your listener is called with the confirmation that offers have been received."

    invoke-static {v0, v1}, Lcom/sponsorpay/sdk/android/utils/SponsorPayLogger;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 243
    const/4 v0, 0x0

    goto :goto_0
.end method
